<template>
	<view class="update" :style="{paddingTop: paddingHeight + 'px'}">
		<nav-bar></nav-bar>
		<view class="m-container">
			<view class="t-1">
				弹性代谢分数获得更新
			</view>
			<view class="t-2">
				您的弹性代谢分数更新目标在过去一周已达成。
			</view>
			<view class="grade">
				<view class="details">
					<view class="pre">{{ scoreInfo.beforeMbScore ? scoreInfo.beforeMbScore.toFixed(2) : 0 }}</view>
					<u-image width="60rpx" height="42rpx" :showMenuByLongpress="false"
						src="http://oss.antaimedical.com/images/static/2024/08/66bef264e4b09217821c0fb0YKmQ9ERkB6H18eb0746a13d37283af53f1ed72bc4ebe.png"
						:lazy-load="true"></u-image>
					<view class="current">{{ scoreInfo.mbScore ? scoreInfo.mbScore.toFixed(2) : 0 }}</view>
				</view>
				<view class="tips">
					本周代谢弹性分数相比上周{{ formDataFn(scoreInfo.mbScore)}},请保持您的健康习惯,再接再励!
				</view>
			</view>
		</view>
		<view class="large_button" @click="back">
			确定
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				paddingHeight: uni.getStorageSync('navbarHeight'),
				userId: uni.getStorageSync("userId"),
				scoreInfo: {
                    mbScore:0,
                    beforeMbScore:0,
                }
			}
		},
		onLoad(OPTIONS) {
			this.scoreInfo = JSON.parse(OPTIONS.info)
		},
		methods: {
			back() {
				uni.navigateBack()
			},
            formDataFn(data){
                if (data > this.scoreInfo.beforeMbScore) {
					return '提高'
				} else if (data < this.scoreInfo.beforeMbScore) {
					return '降低'
				} else if (data == this.scoreInfo.beforeMbScore) {
					return '持平'
				} else {
					return ''
				}
            }
		}
	}
</script>


<style lang="scss" scoped>
	.update {
		padding-bottom: 80rpx;
	}

	.m-container {
		padding: 48rpx;
		color: #333333;

		.t-1 {
			padding: 0 48rpx;
			font-weight: 500;
			font-size: 32rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			text-align: left;
		}

		.t-2 {
			padding: 0 48rpx;
			font-size: 28rpx;
			margin-top: 16rpx;
			text-align: left;
		}

		.grade {
			margin-top: 48rpx;
			width: 100%;
			padding: 64rpx 48rpx 48rpx 32rpx;
			background: #FAFAFA;
			border-radius: 32rpx;

			.details {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-bottom: 50rpx;

				.pre,
				.current {
					width: 200rpx;
					height: 120rpx;
					line-height: 120rpx;
					background: rgba(#545DDE, 0.05);
					border-radius: 60rpx;
					font-weight: 500;
					font-size: 42rpx;
					color: #545DDE;
					font-family: PingFangSC-Medium, PingFang SC;
				}
			}

			.tips {
				font-size: 24rpx;
				padding-top: 46rpx;
				line-height: 34rpx;
				text-align: left;
				border-top: 1rpx solid rgba(#000000, .1);
			}
		}
	}

	.large_button {
		position: fixed;
		bottom: 76rpx;
		left: 50%;
		transform: translateX(-50%);
	}
</style>